建立Google Apps Script
建立Google Apps Script
1. 建立GAS檔案
Google Spreadsheets上方的選單
「Extensions」
「Apps Script」
2. 撰寫GAS
預設
doGet()
處理GET要求
doPost()
處理POST要求
3. 發佈API
「Deploy」
「Select type」
「網路應用程式(web app)」
「Description」
發佈註解
「將應用程式執行為(Execute the app as)」
「我(Me)」
「具有應用程式存取權的使用者(Who has access to the app)」
「任何人,甚至匿名使用者(Anyone, even anonymous)」
「部署(Deploy)」
「核對權限(Authorize access)」
選擇授權用的 Google 帳號
「進階(Advanced)」
「前往 此應用程式名稱」
Go to [web app name](unsafe)
「允許(Allow)」
「Web app」底下的「URL」即為讀取與寫入用的網址
之後可以從「Deploy」→「Manage deployments」裡查詢
開發時可善用「Test deployments」
「專案版本(Project version)」
既有數字是之前發佈的版本
改動後要選擇「新增」專案版本,才會有效反應